Serve all static assets from the same root directory#891
Merged
outoftime merged 1 commit intopopcodeorg:masterfrom Jul 3, 2017
Merged
Serve all static assets from the same root directory#891outoftime merged 1 commit intopopcodeorg:masterfrom
outoftime merged 1 commit intopopcodeorg:masterfrom
Conversation
Previously assets were served from the `static/` directory; at the root of this directory were unmodified static files that were part of version control, e.g. `index.html`. This contained `static/compiled/`, which contained compiled files (CSS bundle, JS bundle, etc.) and was not under version control. Now all assets are served from the `dist` directory in the root of the project; `static` has moved to `src/static`. The proximate motivation for this is that service workers can’t control files outside of the directory they are served from; so, serving a service worker from `/compiled/sw.js` prevented that service worker from caching `/index.html`. This can be overridden with a header, but since we serve the site statically from S3, that’s not so simple. This change also I think is strictly more sensible.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously assets were served from the
static/directory; at the root of this directory were unmodified static files that were part of version control, e.g.index.html. This containedstatic/compiled/, which contained compiled files (CSS bundle, JS bundle, etc.) and was not under version control.Now all assets are served from the
distdirectory in the root of the project;statichas moved tosrc/static.The proximate motivation for this is that service workers can’t control files outside of the directory they are served from; so, serving a service worker from
/compiled/sw.jsprevented that service worker from caching/index.html. This can be overridden with a header, but since we serve the site statically from S3, that’s not so simple.This change also I think is strictly more sensible.